package com.fesine.ssh.service;

import java.io.File;

/**
 * Created by Fesine on 2016/6/13.
 */
public class ReadFromFile {
    /**
     * @author zdz8207
     */
    public static void main(String[] args) {
        getFileName("c:/");
    }

    public static void getFileName(String path) {
        File f = new File(path);
        if (!f.exists()) {
            System.out.println(path + " not exists");
            return;
        }

        File fa[] = f.listFiles();
        for (int i = 0; i < fa.length; i++) {
            File fs = fa[i];
            if (fs.isDirectory()) {
                System.out.println(fs.getName() + " [目录]");
            } else {
                System.out.println(fs.getName());
            }
        }
    }

}
